Loading TOC...

GET /v1/rest-apis/{name}

Summary

Retrieve configuration information about an App Server servicing the MarkLogic REST API. This request is only available on port 8002.

URL Parameters
format? Specifies the type of the response content, as an alternative to specifying format via the Accept header. Accepted values: json and xml. The format parameter takes precedence over the Accept headers.
group? The name of a MarkLogic Server cluster Group. Use this parameter to disambiguate the instance when multiple Groups contain an instance with the same name.
Request Headers
Accept The expected MIME type of the configuration information in the response. Accepted types: application/json or application/xml. Ignored if the request includes a format parameter value.

Response

Upon success, MarkLogic Server returns status 200 (OK) and the instance configuration details.

Required Privileges

This operation requires the rest-admin role, or the following privileges:

http://marklogic.com/xdmp/privileges/rest-admin

http://marklogic.com/xdmp/privileges/rest-writer

http://marklogic.com/xdmp/privileges/rest-reader

Usage Notes

You may only make this request against port 8002.

The name component of the request URI should be the name of an MarkLogic REST API instance created by making a POST request to /v1/rest-apis. For details, see "POST /v1/rest-apis".

If more than one group contains an instance (or App Server) with the requested name and you do not supply a group parameter, MarkLogic Server returns 400 (Bad Request).

The response contains the App Server configuration information for name, as either JSON or XML. For details on the meaning of the fields, see Creating and Configuring App Servers in the Scripting Administrative Tasks Guide.

Specify the expected response content type using either the format parameter or Accept header. If you supply both, the format parameter takes precedence. If you specify neither, XML is returned.

For more details, see Retrieving Configuration Information in the REST Application Developer's Guide.

Example

curl --anyauth --user user:password -X GET -i -H "Accept: application/xml" \
  http://localhost:8002/v1/rest-apis/my-service

==> Information about the rest service named "my-service", in XML:

Content-type: text/html; charset=UTF-8
Server: MarkLogic
Content-Length: 2001
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/xml; charset=UTF-8
Content-Length: 85
Connection: close

<rapi:rest-api xmlns:rapi="http://marklogic.com/rest-api">
  <rapi:name>my-service</rapi:name>
  <rapi:group>Default</rapi:group>
  <rapi:database>my-database</rapi:database>
  <rapi:modules-database>my-service-modules</rapi:modules>
  <rapi:port>8003</rapi:port>
</rapi:rest-api>
  

Example

curl --anyauth --user user:password -X GET -i \
  -H "Accept: application/json" \
  http://localhost:8002/v1/rest-apis/my-service

==> Information about the rest service named "my-service", in JSON:

Server: MarkLogic
Content-Length: 2004
Connection: close

HTTP/1.1 200 OK
Server: MarkLogic
Content-Type: text/plain; charset=UTF-8
Content-Length: 115
Connection: close

{
  "name": "my-service",
  "group": "Default",
  "database": "bill",
  "modules-database": "my-service-modules",
  "port": "8003"
}
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.